Skip to content

ddev: support passing env vars to ddev env agent#24289

Draft
vitkyrka wants to merge 1 commit into
masterfrom
vitkyrka/ddev-agent-env
Draft

ddev: support passing env vars to ddev env agent#24289
vitkyrka wants to merge 1 commit into
masterfrom
vitkyrka/ddev-agent-env

Conversation

@vitkyrka

@vitkyrka vitkyrka commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a --env KEY=VALUE option to ddev env agent (repeatable) that sets environment variables for a single Agent invocation only, without affecting the container's persistent environment. This threads through AgentInterface.invoke()/run_command(), which now accept an optional env_vars mapping.

For the Docker backend, the variables are passed via docker exec -e KEY=VALUE .... The Vagrant backend does not support per-invocation env vars and raises NotImplementedError if any are supplied.

Motivation

This is needed for process autodiscovery support (see the vitkyrka/disco-config-process stack, PR #24238). That work reuses the existing container-based E2E setup for process-autodiscovery testing by hiding the containers from the Agent via DD_AUTOCONFIG_EXCLUDE_FEATURES=docker, which needs to be set only for the agent check invocation used to trigger discovery, not for the container as a whole.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

vitkyrka commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

and a new --env
option on ddev env agent check to set an environment variable scoped to
a single agent check invocation (via docker exec -e) rather than the
whole Agent container.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 1, 2026

Copy link
Copy Markdown

Pipelines  Tests  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

PR All | test / j924327f / Avi Vantage   View in Datadog   GitHub Actions

PR All | test / j9438e1d / Tomcat   View in Datadog   GitHub Actions

Validate repository | Run Validations / Validate   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 69.57%
Overall Coverage: 88.12% (+0.11%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b585bc6 | Docs | Datadog PR Page | Give us feedback!

@vitkyrka vitkyrka force-pushed the vitkyrka/ddev-agent-env branch from 8d60800 to b585bc6 Compare July 1, 2026 16:32
@vitkyrka vitkyrka added the qa/skip-qa Automatically skip this PR for the next QA label Jul 1, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant